<!--#include file="conn.asp"-->
<!--#include file="chkuser.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<%
dim ArticleID,Action,sqlDel,rsDel,FoundErr,ErrMsg,ObjInstalled
ArticleID=trim(request("ArticleID"))
Action=Trim(Request("Action"))
FoundErr=False
ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")

if ArticleId="" or Action<>"Del" then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>参数不足！</li>"
end if
if FoundErr=False then
	if instr(ArticleID,",")>0 then
		dim idarr,Di
		idArr=split(ArticleID,",")
		for Di = 0 to ubound(idArr)
			call DelArticle(clng(idarr(Di)))
		next
	else
		call DelArticle(clng(ArticleID))
	end if
end if
if FoundErr=False then
	call CloseConn()
	go("Admin_News.asp?showMsgStr=<br><b>文章信息已删除成功！</b>|parent|3000|500||")
else
	call CloseConn()
	call WriteErrMsg(ErrMsg)
end if

sub DelArticle(ID)
	Set rsDel= Server.CreateObject("ADODB.Recordset")
	sqlDel="select * from News where ID=" & CLng(ID)
	rsDel.open sqlDel,conn,1,3
	if DelUpFiles_con=True and ObjInstalled=True then
		dim strUploadFiles,arrUploadFiles
		strUploadFiles=rsDel("UploadFiles") & ""
		if strUploadFiles<>"" then
			if instr(strUploadFiles,"|")>1 then
				arrUploadFiles=split(strUploadFiles,"|")
				for i=0 to ubound(arrUploadFiles)
					call DelFile("../" & arrUploadfiles(i))
				next
			else
				call DelFile("../" & strUploadfiles)
			end if
		end if
		if rsDel("pic")<>"" then call DelFile("../"&rsDel("pic"))
	end if
	rsDel.delete
	rsDel.update
	set rsDel=nothing	
end sub
%>